package com.ruoyi.logistic.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.logistic.domain.NetworkAbnormalData;
import com.ruoyi.logistic.domain.NetworkCustomerSettleStatus;
import com.ruoyi.logistic.service.INetworkAbnormalDataService;
import com.ruoyi.logistic.service.NetworkCustomerSettleStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/network/customerSettleStatus")
@RestController
@Api(tags = "网点财务_客户运费汇总_客户结算类型")
public class NetworkCustomerSettleStatusController {
    @Autowired
    private NetworkCustomerSettleStatusService networkCustomerSettleStatusService;

    @ApiOperation("显示异常数据列表")
    @GetMapping("/selectAll")
    public R selectAll(){
        List<NetworkCustomerSettleStatus> networkCustomerSettleStatusList = networkCustomerSettleStatusService.selectAll();
        if (networkCustomerSettleStatusList == null || networkCustomerSettleStatusList.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(networkCustomerSettleStatusList);
        }
    }
    @ApiOperation("添加异常数据")
    @PostMapping("/insert")
    public R insert(@RequestBody NetworkCustomerSettleStatus networkCustomerSettleStatus){
        Boolean isAdd = networkCustomerSettleStatusService.insert(networkCustomerSettleStatus);
        if (isAdd){
            return R.ok("添加成功");
        }else {
            return R.fail("添加失败");
        }
    }
    @ApiOperation("修改异常数据")
    @PostMapping("/update")
    public R update(@RequestBody NetworkCustomerSettleStatus networkCustomerSettleStatus){
        Boolean isUpdate = networkCustomerSettleStatusService.update(networkCustomerSettleStatus);
        if (isUpdate){
            return R.ok("修改成功");
        }else {
            return R.fail("修改失败");
        }
    }
    @ApiOperation("删除异常数据")
    @PostMapping("/deleteById")
    public R deleteById(Integer id){
        Boolean isDelete = networkCustomerSettleStatusService.deleteById(id);
        if (isDelete){
            return R.ok("删除成功");
        }else {
            return R.fail("删除失败");
        }
    }
}
